package net.cyndeline.components.agent

import net.cyndeline.entitySystem.Component

/**
 * The health of an object on a map.
 */
trait HealthComponent extends Component {
  
  /** The current health amount. */
  def currentHealth: Int
  
  /** Sets a new health amount. */
  def currentHealth_=(amount: Int)
  
  /** The maximum amount of health the entity may have. */
  def maxHealth: Int
  
  /** Sets a new maximum health amount. */
  def maxHealth_=(amount: Int)
}

class Health extends HealthComponent {
  override var currentHealth = 0
  override var maxHealth = 0
  
  override def copy = {
    val copy = new Health()
    copy.currentHealth = currentHealth
    copy.maxHealth = maxHealth
    copy
  }
}